package com.xuecheng.learning.domain.feignclient.fallback;

import com.xuecheng.learning.domain.feignclient.CourseServiceClient;
import com.xuecheng.learning.infrastructure.vo.CoursePublish;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-09-12  22:23
 */
@Slf4j
@Component
public class CourseServiceClientFallbackFactory implements FallbackFactory<CourseServiceClient> {
    @Override
    public CourseServiceClient create(Throwable throwable) {
        return new CourseServiceClient() {
            @Override
            public CoursePublish getCoursepublish(Long courseId) {
                log.error("调用内容管理服务查询课程信息时发生熔断");
                return null;
            }
        };
    }
}
